<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <todo-item v-for="item in list" v-bind:todo="item" v-bind:key="item.id"></todo-item>
        <button v-on:click="reverseList">反转</button>
    </div>
    
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

    <script>
        Vue.component('todo-item',{
            props:['todo'],
            template:'<p>{{todo.id}}.{{todo.text}}</p>'
        })

        var app = new Vue({
            el:'#app',
            data:{
                list:[
                {id:1,text:'飞升者'},
                {id:2,text:'暗裔'},
                {id:3,text:'海克斯生物'},
                {id:4,text:'瓦斯塔亚人'}
                ]
            },
            methods:{
                reverseList:function(){
                    for(i=0;i<this.list.length;i++){
                        this.list[i].text=this.list[i].text.split('').reverse().join('')
                    }
                    
                }
            }
        })
    </script>
</body>
</html>